//! Header for the OdometerObserver class
/*!
	\file OdometerObserver.h
	\author Andreas Lehner
	\date 22.11.2012

*/
#ifndef ODOMETEROBSERVER_H
#define ODOMETEROBSERVER_H

#include "ObserverBase.h"

//! Updates the Odometer and writes the calculated distance to DigitalDisplay.
/*!
\class OdometerObserver
The class OdometerObserver calculates the distance driven
by the automobile. Every distance values are the meters
driven in half of a second. It interacts with the DigitalDisplay
and sends its values to that display. It attaches and detaches itself
in the observer list of class Automobile. (Observer Pattern)
*/
class OdometerObserver : public ObserverBase {
public:
	//! CTor of OdometerObserver
	/*!
	Constructs an OdometerObserver and attaches it to the observer list
	of class Automobile. It also initializes a new DigitalDisplay.
	\param automobile A concrete subject (PKW*) the observer listens to.
	*/
	OdometerObserver(PKW * automobile);
	//! DTor of OdometerObserver
	/*!
	Destructs an OdometerObserver and detaches it from the observer list
	of class Automobile. The DigitalDisplay is being deleted.
	*/
	~OdometerObserver();
	//! Updates the driven distance of a PKW
	/*!
	Calculates the driven distance (meters per half a second) and sends
	the value to the DigitalDisplay for output.
	\throw std::exception if sending to the DigitalDisplay fails.
	*/
	virtual void Update();

private:
	//describes the driven distance in meters per half of a second
	//of a PKW
	double mDistance;
	//constants for distance calculation
	static double const cMeterfactor;
	static double const cHalfsec;
};

#endif